﻿
 //----------------以下为公共部分-------------
function showsubmenu(sid) {
    var whichEl = document.getElementById("submenu" + sid);

    if (whichEl.style.display == "none") {
        whichEl.style.display = "";
        document.getElementById("menutop" + sid).className = "topOff";
    }
    else {
        whichEl.style.display = "none";
        document.getElementById("menutop" + sid).className = "topOn";
    }
}
//首页tag切换效果
function showShortcutContent(tabobj, num) {

    
    i=num-1;
    //alert($(tabobj).attr("class"));
    $(tabobj).parent().children("h5").removeClass();
    $(tabobj).removeClass().addClass("On01");
    $(tabobj).parent().nextAll().css("display","none");
    $(tabobj).parent().nextAll().eq(i).css("display","block");
}
//获取首页日期
function getDate(id) {
    var myDate = new Date();
    var dYear = myDate.getFullYear().toString();   //获取完整的年份(4位,1970-????)
    var dMonth = myDate.getMonth().toString();      //获取当前月份(0-11,0代表1月)
    var dDay = myDate.getDate().toString();       //获取当前日(1-31)
    
    dMonth = parseInt(dMonth) + 1;
    
    if ((dMonth.toString().length) < 2) {
        dMonth = "0" + dMonth;
    } 
    if (dDay.length < 2) {
        dDay = "0" + dDay;
    } 
    var str = dYear + "年" + dMonth + "月" + dDay +"日";
    document.getElementById(id).innerHTML = str;
}

/*
//导航栏鼠标点击效果

function MMClick(id)
{
	window.location.href=$("#"+id+" > a").attr("href");
}
//导航栏鼠标划过效果切换Start
function MMOver(id,menuid) {
     
    //$(".secMenu-center").css("display","none");
    //$("#secMenu"+id).css("display","block");
        	if(id==menuid){
        	}else{
        	$("#Menu_"+id).removeClass().addClass('menu_hover');
        	}
   
}
function MMOut(id,menuid) {
   // $(".secMenu-center").css("display","none");
    if (id == menuid) {
             
    }else
    {
         switch (id)
    {
        case '0':
        	//$(".secMenu-center").css("display","none");
        	//$("#secMenu"+id).css("display","block");
        	$("#Menu_"+id).removeClass().addClass('fstmenu_off');
            break;
        case '8':
	       // $(".secMenu-center").css("display","none");
        	//$("#secMenu"+id).css("display","block");
        	$('#Menu_'+id).removeClass().addClass('lstmenu_off');
            break;
        default:
        	//$(".secMenu-center").css("display","none");
        	//$("#secMenu"+id).css("display","block");
        	$('#Menu_'+id).removeClass().addClass('menu_off');
            break;
            
    }
    }
  //  SecMMOut($("#secMenu"+id),menuid)
  }
  
function SecMMOut(obj,menuid)
{
	$(".secMenu-center").css("display","none");
	$("#secMenu"+menuid).css("display","block");
	var id = $(obj).attr("id").substring($(obj).attr("id").length-1,$(obj).attr("id").length);
	if (id == menuid) {
        	$('#Menu_'+id).removeClass().addClass('menu_on');
     
    }else
    {
         switch (id)
    {
        case '0':
        	$("#Menu_"+id).removeClass().addClass('fstmenu_off');
            break;
        case '8':
        	$('#Menu_'+id).removeClass().addClass('lstmenu_off');
            break;
        default:
        	$('#Menu_'+id).removeClass().addClass('menu_off');
            break;
    }
    }

}


function SecMMOver(obj)
{
	$(".secMenu-center").css("display","none");
	$(obj).css("display","block");
	$(obj).children().filter("a").bind("mouseover",function(){$($(this).parent()).css("display","block");});
	var id = $(obj).attr("id").substring($(obj).attr("id").length-1,$(obj).attr("id").length);
	if(id==menuid)
	{
		
	}else{
	$("#Menu_"+id).removeClass().addClass('menu_hover');
	}
}
*/
//导航栏鼠标划过效果切换End

/* id:导航栏menu的id */
/*
function showMenu(id) {
		
	//alert(str);
    switch (id)
    {
        case '0':
        	$(".secMenu-center").css("display","none");
        	$("#secMenu"+id).css("display","block");
        	$("#Menu_"+id).removeClass().addClass('fstmenu_on');
            break;
        case '8':
	        $(".secMenu-center").css("display","none");
        	$("#secMenu"+id).css("display","block");
        	$('#Menu_'+id).removeClass().addClass('lstmenu_on');
            break;
        default:
        	$(".secMenu-center").css("display","none");
        	$("#secMenu"+id).css("display","block");
        	$('#Menu_'+id).removeClass().addClass('menu_on');
            break;
            
    }
}
*/
/* 获取用户状态所需函数 Start*/
        // utility function to retrieve an expiration data in proper format;
        function getExpDate(days, hours, minutes) {
            var expDate = new Date();
            if (typeof (days) == "number" && typeof (hours) == "number" && typeof (hours) == "number") {
                expDate.setDate(expDate.getDate() + parseInt(days));
                expDate.setHours(expDate.getHours() + parseInt(hours));
                expDate.setMinutes(expDate.getMinutes() + parseInt(minutes));
                return expDate.toGMTString();
            }
        }

        //utility function called by getCookie()
        function getCookieVal(offset) {
            var endstr = document.cookie.indexOf(";", offset);
            if (endstr == -1) {
                endstr = document.cookie.length;
            }
            return unescape(document.cookie.substring(offset, endstr));
        }

        // primary function to retrieve cookie by name
        function getCookie(name) {
            var arg = name + "=";
            var alen = arg.length;
            var clen = document.cookie.length;
            var i = 0;
            while (i < clen) {
                var j = i + alen;
                if (document.cookie.substring(i, j) == arg) {
                    return getCookieVal(j);
                }
                i = document.cookie.indexOf(" ", i) + 1;
                if (i == 0) break;
            }
            return;
        }

        // store cookie value with optional details as needed
        function setCookie(name, value, expires, path, domain, secure) {
            document.cookie = name + "=" + escape(value) +
                    ((expires) ? "; expires=" + expires : "") +
                    ((path) ? "; path=" + path : "") +
                    ((domain) ? "; domain=" + domain : "") +
                    ((secure) ? "; secure" : "");
        }

        // remove the cookie by setting ancient expiration date
        function deleteCookie(name, path, domain) {
            if (getCookie(name)) {
                document.cookie = name + "=" +
                        ((path) ? "; path=" + path : "") +
                        ((domain) ? "; domain=" + domain : "") +
                        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
            }
        } 
/* 获取用户状态所需函数 End */

/* 调整字体大中小 Start */
function doZoom(id,size){

  document.getElementById(id).style.fontSize=size;
  $("#"+id).parent().find(".WinRight").find("a").css("font-weight","normal");
  var _innerT = $("#"+id).parent().find(".WinRight")
  switch(size){
  	case '1.4em':
  		_innerT.find("a").eq(0).css("font-weight","bold");
  		break;
  	case '1.2em':
  		_innerT.find("a").eq(1).css("font-weight","bold");
  		break;
  	default:
  		_innerT.find("a").eq(2).css("font-weight","bold");
  } 
 }
/* 调整字体大中小 End */

/* 滑动折叠菜单开始 */
/*参数说明
id:boxID;
showId:初始显示div序号，需传递非负整数
0-理财工具
1-收费标注
2-行情与数据
*/
function SDMenu(id,showId) {
    if (!document.getElementById || !document.getElementsByTagName)
        return false;
    //this.menu = document.getElementById(id);
    //this.submenus = this.menu.getElementsByTagName("div");
	this.menu=$("#"+id);
    this.submenus = $("#" + id + " > div");
    this.remember = true;
    this.speed = 10;
    this.markCurrent = false;
    this.oneSmOnly = true;
    this.showDivId=showId;
}
SDMenu.prototype.init = function() {
    var mainInstance = this;
    for (var i = 0; i < this.submenus.length; i++)
        this.submenus[i].getElementsByTagName("span")[0].onclick = function() {
            mainInstance.toggleMenu(this.parentNode);
        };
    if (this.markCurrent) {
        var links = this.menu.getElementsByTagName("ul");
        for (var i = 0; i < links.length; i++)
            if (links[i].href == document.location.href) {
            links[i].className = "current";
            break;
        }
    }
    if (this.remember) {
        var regex = new RegExp("sdmenu_" + encodeURIComponent(this.menu.id) + "=([01]+)");
        var match = regex.exec(document.cookie);
        if (match) {
            var states = match[1].split("");
            for (var i = 0; i < states.length; i++)
                this.submenus[i].className = (states[i] == 0 ? "collapsed" : "");
        }
    }
    for (var i = 0; i < this.submenus.length; i++)
    {
        if(i==this.showDivId)
        {
            this.submenus[i].className="";
        }
        else
        {
            this.submenus[i].className="collapsed";
        }
    }
};
SDMenu.prototype.toggleMenu = function(submenu) {
    if (submenu.className == "collapsed")
        this.expandMenu(submenu);
    else
        this.collapseMenu(submenu);
};
SDMenu.prototype.expandMenu = function(submenu) {
    var fullHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
    var links = submenu.getElementsByTagName("a");
    for (var i = 0; i < links.length; i++)
        if(links.length==0)
        {
            fullHeight=offsetHeight
        }else
        {
            fullHeight += links[i].offsetHeight;
        }
        
    var moveBy = Math.round(this.speed * links.length);

    var mainInstance = this;
    var intId = setInterval(function() {
        var curHeight = submenu.offsetHeight;
        var newHeight = curHeight + moveBy;
        if (newHeight < fullHeight)
            submenu.style.height = newHeight + "px";
        else {
            clearInterval(intId);
            submenu.style.height = "";
            submenu.className = "";
            mainInstance.memorize();
        }
    }, 30);
    this.collapseOthers(submenu);
};
SDMenu.prototype.collapseMenu = function(submenu) {
    var minHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
    var moveBy = Math.round(this.speed * submenu.getElementsByTagName("a").length);
    var mainInstance = this;
    var intId = setInterval(function() {
        var curHeight = submenu.offsetHeight;
        var newHeight = curHeight - moveBy;
        if(moveBy==0)
        {
            clearInterval(intId);
            submenu.style.height = "";
            submenu.className = "collapsed";
            mainInstance.memorize();
        }else
        {
        if (newHeight > minHeight)
            submenu.style.height = newHeight + "px";
        else {
            clearInterval(intId);
            submenu.style.height = "";
            submenu.className = "collapsed";
            mainInstance.memorize();
        }
        }
    }, 30);
};
SDMenu.prototype.collapseOthers = function(submenu) {
    if (this.oneSmOnly) {
        for (var i = 0; i < this.submenus.length; i++)
            if (this.submenus[i] != submenu && this.submenus[i].className != "collapsed")
            this.collapseMenu(this.submenus[i]);
    }
};
SDMenu.prototype.expandAll = function() {
    var oldOneSmOnly = this.oneSmOnly;
    this.oneSmOnly = false;
    for (var i = 0; i < this.submenus.length; i++)
        if (this.submenus[i].className == "collapsed")
        this.expandMenu(this.submenus[i]);
    this.oneSmOnly = oldOneSmOnly;
};
SDMenu.prototype.collapseAll = function() {
    for (var i = 0; i < this.submenus.length; i++)
        if (this.submenus[i].className != "collapsed")
        this.collapseMenu(this.submenus[i]);
};
SDMenu.prototype.memorize = function() {
    if (this.remember) {
        var states = new Array();
        for (var i = 0; i < this.submenus.length; i++)
            states.push(this.submenus[i].className == "collapsed" ? 0 : 1);
        var d = new Date();
        d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000));
        document.cookie = "sdmenu_" + encodeURIComponent(this.menu.id) + "=" + states.join("") + "; expires=" + d.toGMTString() + "; path=/";
    }
};
/* 滑动折叠菜单结束 */


/* 左右切换产品js Start */

<!--//--><![CDATA[//><!-- 
//图片切换列表 
var Speed = 10; //速度(毫秒) 
var Space = 5; //每次移动(px) 
var PageWidth = 230; //翻页宽度 
var fill = 0; //整体移位 
var MoveLock = false; 
var MoveTimeObj; 
var Comp = 0; 
var AutoPlayObj = null; 
function GetObj(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}} 
function AutoPlay(objID,listID){ //自动滚动 
 clearInterval(AutoPlayObj); 
 AutoPlayObj = setInterval("ISL_GoDown('"+objID+"','"+listID+"');ISL_StopDown('"+objID+"','"+listID+"');",5000); //间隔时间 
} 
function ISL_GoUp(objID,listID){ //上翻开始 
 if(MoveLock) return; 
 clearInterval(AutoPlayObj); 
 MoveLock = true; 
 MoveTimeObj = setInterval("ISL_ScrUp('"+objID+"','"+listID+"');",Speed); 
} 
function ISL_StopUp(objID,listID){ //上翻停止 'ISL_Cont'
 clearInterval(MoveTimeObj); 
 if(GetObj(objID).scrollLeft % PageWidth - fill != 0){ 
  Comp = fill - (GetObj(objID).scrollLeft % PageWidth); 
  CompScr(objID); 
 }else{ 
  MoveLock = false; 
 } 
 AutoPlay(objID,listID); 
} 
function ISL_ScrUp(objID,listID){ //上翻动作 'ISL_Cont'  'List1'
 if(GetObj(objID).scrollLeft <= 0){GetObj(objID).scrollLeft = GetObj(objID).scrollLeft + GetObj(listID).offsetWidth} 
 GetObj(objID).scrollLeft -= Space ; 
} 
function ISL_GoDown(objID,listID){ //下翻 
 clearInterval(MoveTimeObj); 
 if(MoveLock) return; 
 clearInterval(AutoPlayObj); 
 MoveLock = true; 
 ISL_ScrDown(objID,listID); 
 MoveTimeObj = setInterval("ISL_ScrDown('"+objID+"','"+listID+"')",Speed); 
} 
function ISL_StopDown(objID,listID){ //下翻停止 'ISL_Cont'
 clearInterval(MoveTimeObj); 
 if(GetObj(objID).scrollLeft % PageWidth - fill != 0 ){ 
  Comp = PageWidth - GetObj(objID).scrollLeft % PageWidth + fill; 
  CompScr(objID); 
 }else{ 
  MoveLock = false; 
 } 
 AutoPlay(objID,listID); 
} 
function ISL_ScrDown(objID,listID){ //下翻动作 'ISL_Cont' 'List1'
 if(GetObj(objID).scrollLeft >= GetObj(listID).scrollWidth){GetObj(objID).scrollLeft = GetObj(objID).scrollLeft - GetObj(listID).scrollWidth;} 
 GetObj(objID).scrollLeft += Space ; 
} 
function CompScr(objID){ //'ISL_Cont'
 var num; 
 if(Comp == 0){MoveLock = false;return;} 
 if(Comp < 0){ //上翻 
  if(Comp < -Space){ 
   Comp += Space; 
   num = Space; 
  }else{ 
   num = -Comp; 
   Comp = 0; 
  } 
  GetObj(objID).scrollLeft -= num; 
  setTimeout("CompScr('"+objID+"')",Speed); 
 }else{ //下翻 
  if(Comp > Space){ 
   Comp -= Space; 
   num = Space; 
  }else{ 
   num = Comp; 
   Comp = 0; 
  } 
  GetObj(objID).scrollLeft += num; 
  setTimeout("CompScr('"+objID+"')",Speed); 
 } 
} 
//--><!]]> 


/* 左右切换产品js End */

/* tag切换效果 Start */
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
	   if(i==0)
	   {
	   //alert(i);
	   //$(this).addclass("class","active FirstTab");
	   //$("#"+tabObj+"_Content"+i).css("display","block");
	   thisObj.className = "active FirstTab"; 
	   document.getElementById(tabObj+"_Content"+i).style.display = "block"
	   }else
	   {
		   thisObj.className = "active"; 
		   document.getElementById(tabObj+"_Content"+i).style.display = "block";
	   }
  }else{
	  	if(i==0)
	   {
		  // $("#"+tabList[i]).attr("class","normal FirstTab");
		   tabList[i].className = "normal FirstTab"; 
		   document.getElementById(tabObj+"_Content"+i).style.display = "none";
	   }else
	   {
		   tabList[i].className = "normal"; 
		   document.getElementById(tabObj+"_Content"+i).style.display = "none";
	   }
  }
} 
}
/* tag切换效果 End*/

/* 下拉框效果变换 */
/*thisobj:控件名
  Num:获取的结果
  preid:需要显示内容的div的前缀
*/
function DownLoadListChange(thisObj,Num,preid){
for(i=0; i <thisObj.length; i++)
{
  if (i == Num)
  {
	$("#"+preid+i).css("display","block");
   //document.getElementById("show_Content"+i).style.display = "block";
  }else{
	$("#"+preid+i).css("display","none");
   //document.getElementById("show_Content"+i).style.display = "none";
  }
} 
}


//加入收藏
function AddFavorite(url)
{
if (document.all)
{ 
window.external.addFavorite(url,'中国农业银行'); 
}else if (window.sidebar)
{ window.sidebar.addPanel('中国农业银行', url, ""); }
} 

//复制链接
function copySss(url)  { 
var clipBoardContent=url;
window.clipboardData.setData("Text",clipBoardContent);
if (clipboardData.getData("Text") != clipBoardContent){
window.alert("复制链接失败!"); 
}else{
window.alert("复制链接成功!");}
}



//信息内容页折叠效果

/*
    showID为非负整数
    */
    function SlideEffect(objID, showID) {
        var i = -1;

        $("#" + objID).children().each(function() {
            i = i + 1;
            var menuObj = $(this).children().eq(0);
            var contentOjb = $(this).children().eq(1);
            //contentOjb.attr("showState", "false");
            if (i == showID) {
                contentOjb.attr("showState", "true");
                menuObj.find("span").attr("class","SlideEffectMenuOn");
            }
            else {
                contentOjb.css("display", "none");
                contentOjb.attr("showState", "false");
                menuObj.find("span").attr("class","SlideEffectMenuOff");
            }
           
            
            menuObj.find("span").eq(0).bind("click", function() {
                if (contentOjb.attr("showState") == "true") {
                    contentOjb.slideUp("fast");
                    contentOjb.attr("showState", "false");
                    //menuObj.find("span").find("img").eq(0).attr("src","./xia1.jpg");
                    menuObj.find("span").attr("class","SlideEffectMenuOff");
                }
                else {
                    contentOjb.slideDown("fast");
                    contentOjb.attr("showState", "true");
                    //menuObj.find("span").find("img").eq(0).attr("src","./shang1.jpg");
                    menuObj.find("span").attr("class","SlideEffectMenuOn");
                }
            }).css("cursor", "pointer");
        });
    }

//图片滚动效果 Begin

    //主函数
    function Play(scrollDivId,OCClassName) {
        var normalSpeed = 30;
        var fastSpeed = 15;
        var OutContainer = $("#" + scrollDivId + " ."+OCClassName+":first");
        var Container1 = $("#" + scrollDivId + " .Container1:first");
        var Container2 = $("#" + scrollDivId + " .Container2:first");
        var leftButton = $("#" + scrollDivId + " .leftButton:first");
        var rightButton = $("#" + scrollDivId + " .rightButton:first");
        var MyMar;
        var IsStop = "left";
        Container2.html(Container1.html());



        MyMar = setInterval("ContentMarquee('"+scrollDivId+"','" + IsStop + "','"+ OCClassName +"')", normalSpeed);

        OutContainer.mouseover(function() {
            clearInterval(MyMar);
            IsStop = "stop";
            MyMar = setInterval("ContentMarquee('" + scrollDivId + "','" + IsStop + "','"+ OCClassName +"')", normalSpeed);
        })
        OutContainer.mouseout(function() {
            IsStop = "left";
            MyMar = setInterval("ContentMarquee('" + scrollDivId + "','" + IsStop + "','"+ OCClassName +"')", normalSpeed);
        })

        leftButton.hover(
        function() {
            clearInterval(MyMar);
            IsStop = "left";
            MyMar = setInterval("ContentMarquee('" + scrollDivId + "','" + IsStop + "','"+ OCClassName +"')", fastSpeed);
        }
        ,
        function() {
            clearInterval(MyMar);
            IsStop = "left";
            MyMar = setInterval("ContentMarquee('" + scrollDivId + "','" + IsStop + "','"+ OCClassName +"')", normalSpeed);

        }
    );
        rightButton.hover(
        function() {
            clearInterval(MyMar);
            IsStop = "right";
            MyMar = setInterval("ContentMarquee('" + scrollDivId + "','" + IsStop + "','"+ OCClassName +"')", fastSpeed);
        }
        ,
        function() {
            clearInterval(MyMar);
            IsStop = "left";
            MyMar = setInterval("ContentMarquee('" + scrollDivId + "','" + IsStop + "','"+ OCClassName +"')", normalSpeed);

        }
    );
    }
    //核心函数

    function ContentMarquee(scrollDivId, pIsStop,OCClassName) {
        var pDemo = $("#" + scrollDivId + " ."+ OCClassName +":first");
        var pDemo1 = $("#" + scrollDivId + " .Container1:first");

        //alert(pDemo);
        if (pIsStop == "left") {
            if (pDemo.scrollLeft() >= pDemo1.width())
                pDemo.scrollLeft(0);
            else {
                pDemo.scrollLeft(pDemo.scrollLeft() + 1);
            }
        }
        if (pIsStop == "right") {
            if (pDemo.scrollLeft() == 0) {
                pDemo.scrollLeft(pDemo1.width());
            } else {
                pDemo.scrollLeft(pDemo.scrollLeft() - 1);
            }

        }
    }


//图片滚动效果 End

//div仿select效果 start
    ///绝对定位的left top等位置值在调用时指定  
function loadselect(input, arraystr) // TAG：arraystr为以 | 分割的字符串
{


$(input).before();

	var boxdiv = $(document.createElement("div"));
	var boxul = $(document.createElement("ul"));
	var boxbr = $(document.createElement("br"));
	boxdiv.attr("id", "SelectBox");
	boxdiv.attr("class", "SelectBox");
	arraystr = arraystr.split("|");
	$.each(arraystr,
	function(temp) {
		var boxli = $(document.createElement("li"));
		boxli.html(arraystr[temp]);
		boxul.append(boxli)
	});
	boxdiv.append(boxul); 
	$(input).after(boxbr, boxdiv);
	
}
function selectvalue(divid,input) {
	$("#"+divid+" > .SelectBox").slideToggle("normal");
	$("#"+divid+" > .SelectBox > ul>li").hover(function() {
		$(this).addClass("hover");
	},
	function() {
		if ($(this).html() != $(input).val()) {
			$(this).removeClass("hover");
		}
	});
	$("#"+divid+" > .SelectBox > ul>li").css("width","212px");
	$("#"+divid+" > .SelectBox > ul>li").each(function(temp) {
		if ($($("#"+divid+" > .SelectBox > ul>li")[temp]).html() == $(input).val()) {
			$("#"+divid+" > .SelectBox > ul>li").removeClass("hover");
			$($("#"+divid+" > .SelectBox > ul>li")[temp]).addClass("hover");
		};
	});
	$("#"+divid+" > .SelectBox > ul>li").click(function() {
		$(input).val($("#"+divid+" > .SelectBox > ul>li>a").html());
		//alert($("#"+divid+" > .SelectBox > ul>li>a").attr("href"));
		//$("#"+divid+" > .SelectBox > ul>li>a").click(); 
		$("#"+divid+" > .SelectBox").slideUp("normal");
		//window.open($("#"+divid+" > .SelectBox > ul>li>a").attr("href"));
		window.location=$("#"+divid+" > .SelectBox > ul>li>a").attr("href");
	});
}

//div仿select效果 end


//电子银行解决方案显示结果
//OutId:外围大的div的id
//Id:需要显示的div的id
function ShowEBankResult(OutId,Id)
{
	
	$("#"+OutId+" > div[class*='CommonSpan']").css({display:"none"});
	$("#"+Id).css({display:"block"});
}

function dmSelect(name,value,data){ 
 $("#" + name).attr("readonly","readonly");  //设置控件只读 
var dtop = $("#" + name).offset().top;   //获取控件top、left位置和width、height 
// var dtop = $("#" + name).offsetParent()?($("#" + name).offset().top+$("#" + name).offsetParent().offset().top):$("#" + name).offset().top;
 var ptop = $("#" + name).offsetParent().offset().top;
 //alert(dtop-$("#" + name).offsetParent().offset().top);
 var sTop=dtop-ptop+19;
 var dleft = $("#" + name).offset().left; 
 var pleft = $("#" + name).offsetParent().offset().left
 var sLeft = dleft-pleft;
 var height = $("#" + name).height(); 
 var width = $("#" + name).width();
 var option_open = false;      //标记是否打开下拉option 
 function __dropheight(l){var h;if(l>10 || l<1){h = 10 * 17;}else{h = l * 17; }return h;}  //计算下拉option显示高度 
 var div_html = "<div id='_li_"+name+"' style='margin-top:-1px; float:left;background-color:#FFFFFF;position:absolute;top:"+sTop+"px;left:"+(sLeft)+"px;width:"+((width<178)?178:width)+"px;height:"+__dropheight(data.length)+"px;border:1px #ccc solid;overflow-x:hidden;overflow-y:auto;display:none;cursor:default; z-index:99999;'>"; 
 //for循环填充option 
 for(var i = 0;i < data.length; i++){div_html += "<div style='text-align:left;padding-left:5px;height:17px;line-height:17px; vertical-align:middle' value='" + data[i][1] + "'>" + data[i][0] + "</div>";} 
 div_html += "</div>"; 
 $("#" + name).after(div_html);  //添加到input控件后面 
 function __open_option(){$("div[id^='_li_']").hide();$("#_li_" + name).show();option_open=true;}  //显示下拉option 
 function __hide_option(){$("#_li_" + name).hide();option_open=false;$(document).unbind("click",__hide_option);}  //隐藏下拉option 
 $("#" + name).click(function(event){if(option_open){__hide_option();}else{__open_option();$(document).bind("click",__hide_option)}event.stopPropagation();}); 
 $("#_li_" + name + " > div").hover(function(){$(this).css({"background-color":"#3399ff","height":"17px","vertical-align":"middle","line-height":"17px"});},function(){$(this).css({"background-color":"#FFFFFF","height":"17px","vertical-align":"middle","line-height":"17px"});}) 
 .click(function(){
 //$("#" + name).val($(this).html());
 $("#" + value).val($(this).attr("value"));
 window.location=$("#" + value).val();}); 
}; 
//<!--实现div模拟select插件代码--> 

//手动控制Accordion的打开面板

function AssignAccordion(accordionid,num)
		{
			$("#" + accordionid).accordion("activate",num)
		}


//弹出框口
function OpenWindow(url,width,height,top,left)
{
	window.open(url,"cssrain","left="+left+",top="+top+",width="+width+",height="+height+"","resize=auto");
}


//提点建议部分
$(function() {
    $('a').click(function(e) {
        if (this.className == "ModuleDialog") {
            e.preventDefault();
            var $this = $(this);
            var horizontalPadding = 30;
            var verticalPadding = 30;
            $('<iframe frameborder="0" id="externalSite" class="externalSite" src="' + this.href + '" />').dialog({
                title: ($this.attr('title')) ? $this.attr('title') : '提点建议',
                autoOpen: true,
                width: 550,
                height: 380,
                modal: true,
                resizable: false,
                autoResize: true,
                overlay: {
                    opacity: 0.5,
                    background: "black"
                }
            }).width(550 - horizontalPadding).height(380 - verticalPadding);
        }
    });
});   


        $(function() {
$.fn.extend({
	"followDiv":function(str){
		var _self = this;
		var pos; //层的绝对定位位置
		switch(str){
			case("leftbottom")://右下角
				pos={"left":"10px","bottom":"10px"};
				break;

			case("rightbottom")://右下角
				pos={"right":"10px","bottom":"10px"};
				break;
			default :   //默认为右下角
				pos={"right":"10px","bottom":"10px"};
				break;
		}
		/*FF和IE7可以通过position:fixed来定位，*/
		_self.css({"position":"fixed","z-index":"9999"}).css(pos);
		/*ie6需要动态设置距顶端高度top.*/
		if($.browser.msie && $.browser.version == 6) {
		
				_self.css('position','absolute');						
				$(window).scroll(function(){
					var topIE6;
					if(str=="rightbottom"||str=="leftbottom"){
						topIE6=$(window).scrollTop() + $(window).height() - _self.outerHeight();
					}else if(str=="lefttop"||str=="righttop"){
						topIE6=$(window).scrollTop();
					}else{
						topIE6=$(window).scrollTop() + $(window).height() - _self.outerHeight();
					}
					//alert($(_self).offset().top);
					$(_self).css( 'top' , topIE6);
				});
		}
		return _self;  //返回this，使方法可链。
	}
});
});

 //获取iframe子页面的方法，需调用才能实现 (<body onload="doShow()">)
    function iframeResize(frameId, frameName) {
        var dyniframe = null;
        var indexwin = null;
        if (document.getElementById) {
            if (!frameId) {
                frameId = frameId;
                frameName = frameName;
            }
			
            dyniframe = document.getElementById(frameId);
            indexwin = window;
            if (dyniframe) {
                var contentHeight, win = indexwin.frames[frameName];
                if (win.innerHeight && win.scrollMaxY) {
                    contentHeight = win.innerHeight + win.scrollMaxY;
                } else if (win.document.body.scrollHeight > win.document.body.offsetHeight) { // all but Explorer Mac   
                    contentHeight = win.document.body.scrollHeight;
                } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari   
                    contentHeight = win.document.body.offsetHeight;   
                }
                dyniframe.height = (!contentHeight || contentHeight < 100) ? 100 : contentHeight;
				//alert(dyniframe.height);
            }
        }
    }

//弹出窗口根据内容重设窗口大小
//id：内容部分最外围的id值
    	function reSize(id)
    	{
			window.resizeTo($("#"+id).width()+10,$("#"+id).height()+80);
    	}


//处理错误信息
function doNothing(){ return true; } 
window.onerror = doNothing;
/*=========================================TRS JavasCript=============================*/ 
//通过TRS 频道号获取MenuId 若有  
//ChanId为 通过置标获取到的 栏目号（唯一）
// 使用范例: getMenuIdByChannel(<TRS_CHANNEL ID='OWNER' FIELD='')
function getMenuIdByChannel(ChanId){
	var MenuId = "1";
	var ChannelIds = "29;56;85;95;148;158;225";
	var ChannelArray = new Array();
	ChannelArray = ChannelIds.split(";");
	//alert(ChannelArray[0]);
	for(i=1;i<9;i++){
		if(ChannelArray[i-1]==ChanId){
			MenuId = i+1;	
		}
	}
	return MenuId;
  }
// TRS 翻页JS 代码 
/*	参数
	nCurrentPage 当前页
	nCountPage   总页数
	sPageName    文件名
	sPageEXT     后缀名
	使用范例：getNav(${PAGE_INDEX},"${PAGE_COUNT}","${PAGE_NAME}","${PAGE_EXT}"); 
*/
function getNav(nCurrentPage,nCountPage,sPageName,sPageEXT)
{ 
	var currentPage = nCurrentPage;
	var prevPage = currentPage-1;
	var nextPage = currentPage+1;
	var countPage = nCountPage;
	var pageLast = nCountPage-1;
	//document.write("<span class='huang12_h'>共"+countPage+"页"+RECORD_COUNT+"条记录&nbsp;&nbsp;</span>");
	document.write("<div id='pager2' class='scott'>");
	//set prevPage
	if(countPage>1&&currentPage!=0&&currentPage!=1)
		document.write("<a href=\""+sPageName+"_" + prevPage + "."+sPageEXT+"\" class='disabled'>&lt;</a>&nbsp;");
	else if(countPage>1&&currentPage!=0&&currentPage==1)
		document.write("<a href=\""+sPageName+"."+sPageEXT+"\" class='disabled'>&lt;</a>&nbsp;");
	else
		document.write("<a href=\"#\" class='disabled'>&lt;</a>&nbsp;");
	//循环
	var num = 6;
	for(var i=0+(currentPage-1-(currentPage-1)%num) ; i<=(num+(currentPage-1-(currentPage-1)%num))&&(i<countPage) ; i++){
		if(currentPage==i)
			document.write("<span class='current'>"+(i+1)+"</span>");
		else if(i==0)
			document.write("<a href=\""+sPageName+"."+sPageEXT+"\" class='current'>"+(i+1)+"</a>");
		else
			document.write("<a href=\""+sPageName+"_" + i + "."+sPageEXT+"\" class='current'>"+(i+1)+"</a>");
	}
	//最后一页
	
	//document.write("...<a href=\""+sPageName+"_" + pageLast + "."+sPageEXT+"\" class='current'>"+nCountPage+"</a>");
	
	//设置下一页代码 
	if(countPage>1&&currentPage!=(countPage-1)){
		document.write("&nbsp;<a href=\""+sPageName+"_" + nextPage + "."+sPageEXT+"\" class='disabled'>&gt;</a>");
	}
	else{
		document.write("&nbsp;<a href=\"#\" class='disabled'>&gt;</a>");
	}
	//document.write(" <select id='toPage' class='CommanSelect'> <option value='1'>1</option><option value='2'>2</option><option value='3'>1003</option></select>");                                   
	document.write("</div>");
}

//下拉框跳转
function ABC_jMenu(selObj){
		var newhref= selObj.options[selObj.selectedIndex].value;
		selObj.selectedIndex=0;
		window.location=newhref;
	   }
	   
	   
function ABC_jMenu_blank(selObj){
		var newhref= selObj.options[selObj.selectedIndex].value;
		selObj.selectedIndex=0;
		window.open(newhref);
	   }
	   
/*
$(document).ready(function(){var curl = this.location.href.toString();
    var newcurl;

    if (curl.indexOf('/cn/') != -1)  //包含cn
    {
        newcurl = curl.replace("/cn/", "/zt/");
        $("#tc")[0].href = newcurl;
    }

    if (curl.indexOf('/zt/') != -1) //包含zt
    {
        newcurl = curl.replace("/zt/", "/cn/");
        $("#tc")[0].href = newcurl;
    }
});*/



//---------------------以下为二期新增---------------------------------------------------------------
//导航栏鼠标点击效果
function MMClick(id) {
    window.location.href = $("#" + id + " > a").attr("href");
}
//导航栏鼠标划过效果切换Start
function MMOver(id, menuid) {

    if (id == menuid) {
    } else {
        //$("#Menu_"+id).removeClass().addClass('Menu_hover');
        switch (id) {
            case '0':
                $("#Menu_" + id).removeClass().addClass('FstMenu_hover');
                break;
            case '8':
                $('#Menu_' + id).removeClass().addClass('LstMenu_hover');
                break;
            default:
                $('#Menu_' + id).removeClass().addClass('Menu_hover');
                break;
        }
    }

}
function MMOut(id, menuid) {
    if (id == menuid) {

    } else {
        switch (id) {
            case '0':
                $("#Menu_" + id).removeClass().addClass('FstMenu_off');
                break;
            case '8':
                $('#Menu_' + id).removeClass().addClass('LstMenu_off');
                break;
            default:
                $('#Menu_' + id).removeClass().addClass('Menu_off');
                break;
        }
    }
}



//导航栏鼠标划过效果切换End

/* id:导航栏menu的id */
function showMenu(id) {
    $(".SecMenu-center").addClass('V2_None');
    $("#SecMenu" + id).removeClass('V2_None').css("display", "block");
    var menu = $('#Menu_' + id);
    menu.removeClass();
    switch (id) {
        case 0:
            menu.addClass('FstMenu_on');
            break;
        case 8:
            menu.addClass('LstMenu_on');
            break;
        default:
            menu.addClass('Menu_on');
            break;
    }
    /*================================二级、三级菜单 新增==========================================*/
    if (arguments.length > 1) {
        showSecMenu(id, arguments[1]);
    }
}

/*================================二级、三级菜单 开始==========================================*/

var __ddMenuOpacity = 0.8;
var __hideSpan = 200;
var __showSpan = 200;
var __ddAddAttrName = 'ddMenuClass';
var __ddInit = true;
function showSecMenu(mainId, index) {
    var cssName = 'SecMenuOn';
    var i = index > 0 ? index - 1 : 0;
    $('#SecMenu' + mainId + ' a').removeClass(cssName).eq(i).addClass(cssName);
}

function fixPosition() {

    var cssName = 'ColumnNav';
    var specMode = false;
    $('.' + cssName).each(function (i, n) {
        var ddId = 'tmpId_' + cssName + (i + 1);
        var parent;
        if (__ddInit) {
            $(this).parent().attr(__ddAddAttrName, '#' + ddId);
            var html = '<div Id="' + ddId + '" class="' + cssName + '">' + $(this).html() + '</div>';
            $('body').append(html);
            $(this).show();
            parent = $(this).parent();


            $(this).remove();
        }
        else {
            parent = $('[' + __ddAddAttrName + '="' + '#' + ddId + '"]');
        }

        var pos = parent.offset();
        pos.left -= parent.scrollLeft();
        pos.top -= parent.scrollTop();
        pos.left += 15;
        pos.top += 25;

        $('#' + ddId).css({ 'left': pos.left + 'px', 'top': pos.top + 'px' });
    });

    __ddInit = false;
}
function showDDMenu() {
}
function showDDMenu2() {
    fixPosition();

    var items = $('.thrMenu-leftBg,.thrMenu-centerMore');

    items.click(function () {
        DDClick(this);
        return false;
    })
    .hover(
    function () { },
    function () {
        DDOut(this);
    });
}

function DDClick(sender) {
    var ddId = $(sender).parent().attr(__ddAddAttrName);
    var ddMenu = $(ddId);
    if (ddMenu != null) {
        $('body').one('click', function () {
            DDOut(this);
        });
        ddMenu
        .show()
        .css({ 'opacity': 0 })
        .animate({ 'opacity': __ddMenuOpacity }, __showSpan,
            function () {
                if (ddMenu.attr('sethover') != 'true') {
                    ddMenu.hover(function () {
                        V2DDMenuHover(this);
                    },
                    function () {
                        V2DDMenuOut(this);
                    });
                    ddMenu.attr('sethover', 'true');
                }
            }
    );

    }
}

function DDOut(sender) {
    var ddId = $(sender).parent().attr(__ddAddAttrName);
    var ddMenu = $(ddId);
    ddMenu
    .delay(400)
    .animate(
        { 'opacity': 0.0 }, __hideSpan, function () {
            $(this).hide();
        }
    );
}

function V2DDMenuHover(sender) {
    $(sender).stop(true)
    .animate(
        { 'opacity': __ddMenuOpacity }, __showSpan
    );
}
function V2DDMenuOut(sender) {
    $(sender).stop(true).delay(200)
       .animate(
        { 'opacity': 0 }, __hideSpan, function () {
            $(this).hide();
        }
    );
}

$(document).ready(function () {
    showDDMenu2();
    $(window).bind('resize', function () {
        fixPosition();
    })
    var curl = this.location.href.toString();
    var newcurl

    if (curl.indexOf('/cn/') != -1)  //包含cn
    {
        newcurl = curl.replace("/cn/", "/zt/");
        $("#tc")[0].href = newcurl;
    }

    if (curl.indexOf('/zt/') != -1) //包含zt
    {
        newcurl = curl.replace("/zt/", "/cn/");
        $("#tc")[0].href = newcurl;
    }
});
/*================================二级、三级菜单 结束==========================================*/

function ShowTab(obj,className){
			   var num = $(obj).parent().children("h3").index($(obj)[0]);
   				$(obj).parent().children().attr("class","");
   				$(obj).attr("class",className);
   				$(obj).parent().parent().children().each(function(i){
   				
   					if(i>0)
   					{
   						if(i!=num+1){
   						$(this).hide();
   						}else{
   							$(this).show();
   						}
   						
   					}
   	   				});
			}
	function ShowDiv(obj){
	$(obj).show();	
	}
		
	function ShowDiv(obj,fbox){
	if(fbox!=''){
	var pTop=$(obj).position().top;
	var top=-100+pTop;
	$("#"+fbox).css("top",top);
	$("#"+fbox).show();	
	}else{
	$(obj).show();	
	}
	}
	function HideDiv(fbox){
	$("#"+fbox).hide();	
	}
